angular.module('referencepro', ['flow-div', 'slide-banner'])

.controller 'referProCtrl', ($location, $scope, $state, $http, $ionicHistory, $ionicViewSwitcher,$ionicPopup,paginationFactory,userData,showToast,$ionicActionSheet,$cordovaSocialSharing) ->

    $http.get('/updshop/',params:{action:'referenceupkpro',userid:userData.getToken()})
    .success (resp) ->
        if resp?.status == '0'
            $scope.newGoods = resp.body
            console.log $scope.newGoods
        else
            showToast resp.error
    .error ->
        showToast '网络异常,请检查网络是否连接'

    _.extend $scope,
        goodsGetIn: (goodItem)->
            if goodItem.isadd == '0'
                $state.go 'tab.goods-addypk', {obj: goodItem}
            else
                showToast '不能重复入库该商品'
        goBack: ->
            $ionicViewSwitcher.nextDirection('back')
            $ionicHistory.goBack()
        pick:(item) ->
            console.log item
            $state.go 'tab.market-detail',{item:item}





